<?php
//$control = new BUIControl();
//$activeOperation = Blyn::app()->getActiveOperation();
?>
<script type="text/javascript">
      function send() {
          var msgContent = $("#msgContent").val();
//          var UserOpenid = <?php // echo $openid; ?>;
          var UserOpenid = $("#useropenid").val();
          var AppId = $("#wxAppId").val();
          var AppSecret = $("#wxAppSecret").val();
          if( msgContent != ''){
              $.ajax({
                   url: '<?php echo $control->getAjaxLinkUrl('sendMesaageToShareUsers'); ?>',
                   type: 'POST',
                   data: {msg: msgContent,openid: UserOpenid,wxAppId:AppId,wxAppSecret:AppSecret},
                   datatype: 'json',
                   // async: false,
                   beforeSend: function() {
                       $("#ajax-loaderdiv").show();
                   },
                   success: function(data) {
                       alert("发送成功！");
                        $("#msgContent").val("");
                       //alert('server data:' + data);
                       // on success do some validation or refresh the content div to display the uploaded images 
                       jQuery("#<?php echo $control->getAjaxContainerId(); ?>").load("<?php echo $control->getLayoutView(); ?>");
                   },
                   complete: function() {
                       $("#ajax-loaderdiv").hide();
                   },
                   error: function(data) {
                       alert("success！");
                        $("#msgContent").val("");
                   },
                   cache: false,
                   //contentType: false,
                   //processData: false
               });
              
          }else{
              alert("内容不能为空！");
          }
    }
  document.getElementById('share').style.display='none';
</script>
<style  type="text/css">
    .senduser{
        border-bottom: 1px solid #d3d3d3;
        font-size: 14px;
        color: #545454;
        box-shadow: inset 0 1px 0 0 #fcfcfc;
        line-height: 36px;
        height: 36px;
    }
    .sendContent{
    }
    .msgSender{
        
    }
    .msg_sender{
        margin: 20px 20px 0;
        border: 1px solid #d3d3d3;
    }
    .tab_navs{
        margin-left: -1px;
        background-color: #f5f6f6;
        line-height: 28px;
        border-bottom: 1px solid #d3d3d3;
    }
    .tab_navs li{
        list-style-type: none;
        float: left;
        font-size: 14px;
    }
    .tab_navs a {
    display: block;
    text-decoration: none;
    color: #222;
    outline: 0;
    padding: 0 20px;
    }
    .tab_navs_text{
        background-color: #d3d3d3;
        float: left;
        font-size: 14px;
        line-height: 28px;
    }
    .tab_navs_img{
        background-color: #fff;
        float: left;
        font-size: 14px;
        line-height: 28px;
    }
    .tab_navs_text_img{
        background-color: #fff;
        float: left;
        font-size: 14px;
        line-height: 28px;
    }
    .icon_msg_sender_text{
        background: url(<?php echo Yii::app()->request->baseUrl; ?>/images/msg_tab_select.png) 0 0 no-repeat;
        margin-right: 3px;
        margin-top: -2px;
        width: 22px;
        height: 22px;
        vertical-align: middle;
        display: inline-block;
    }
    .icon_msg_sender_img{
        background: url(<?php echo Yii::app()->request->baseUrl; ?>/images/msg_tab_select.png) 0 -32px no-repeat;
        margin-right: 3px;
        margin-top: -2px;
        width: 22px;
        height: 22px;
        vertical-align: middle;
        display: inline-block;
    }
    .icon_msg_sender_text_img{
        background: url(<?php echo Yii::app()->request->baseUrl; ?>/images/msg_tab_select.png) 0 -128px no-repeat;
        margin-right: 3px;
        margin-top: -2px;
        width: 22px;
        height: 22px;
        vertical-align: middle;
        display: inline-block;
    }
    .editor{
        
    }
    .input-xlarge{
        width: 536px;
    }
    .edit_area{
        overflow-y: auto; overflow-x: hidden;
        padding: 14px 20px;
        background-color: #fff;
        height: 80px;
    }
    .tool_area{
     padding:20px 20px 40px 20px;
    }
    .message_area{
        padding: 0 20px;
    }
    .message_list{
        border-top: 1px solid #dcdcdc;
    }
    .message_item{
        list-style-type: none;
        min-height: 46px;
        border-bottom: 1px solid #dddcdc;
        padding: 15px 0;
    }
</style>
<div> 
    <div class="senduser">
        <h4>
            与&nbsp;<span id="nick_name"><?php echo $nick_name;?></span>&nbsp;的聊天		</h4>
   </div>
    <div class="sendContent">
        <div class="msgSender">
            <div class="msg_sender">
                <ul class="tab_navs">
                    <li class="tab_navs_text">
		    <a href="javascript:void(0);"><i class="icon_msg_sender_text"></i>文字</a></li>
                     <li class="tab_navs_img">
		    <a href="javascript:void(0);"><i class="icon_msg_sender_img"></i>图片</a></li>
                     <li class="tab_navs_text_img">
		    <a href="javascript:void(0);"><i class="icon_msg_sender_text_img"></i>图文消息</a></li>
                </ul>
                <div class="editor">
                    <textarea class="input-xlarge edit_area" rows="4" id="msgContent"></textarea>
                    <!--<div class="edit_area"></div>-->
                </div>
            </div>
            <div class="tool_area">
                 <input type="button" class="btn btn-primary" onclick="send();" value="发 送"  id="sendbtn">
                 <input type="hidden" id="useropenid" value="<?php echo $openid; ?>" />
                 <input type="hidden" id="wxAppId" value="<?php echo $AppId; ?>" />
                 <input type="hidden" id="wxAppSecret" value="<?php echo $AppSecret; ?>" />
            </div>
        </div>
<!--        <div class="message_area">
            <h4>最近5条聊天记录</h4>
            <ul class="message_list">
                <li class="message_item "></li>
            </ul>
        </div>-->
    </div>
</div>